<template>
  <div class="dashboard-container">
    <!-- 内容区域 -->
    <main class="main-content">
      <h1 class="page-title">仪表盘</h1>

      <!-- 数据概览卡片 -->
      <section class="overview-section">
        <div class="overview-cards">
          <div class="card">
            <div class="card-icon">🔢</div>
            <div class="card-content">
              <div class="card-value">1,234</div>
              <div class="card-label">总划线数</div>
            </div>
          </div>
          <div class="card">
            <div class="card-icon">✅</div>
            <div class="card-content">
              <div class="card-value">89%</div>
              <div class="card-label">完成率</div>
            </div>
          </div>
          <div class="card">
            <div class="card-icon">⏱️</div>
            <div class="card-content">
              <div class="card-value">42分钟</div>
              <div class="card-label">平均时长</div>
            </div>
          </div>
          <div class="card">
            <div class="card-icon">⚠️</div>
            <div class="card-content">
              <div class="card-value">12</div>
              <div class="card-label">异常提醒</div>
            </div>
          </div>
        </div>
      </section>

      <!-- 图表和数据区域 -->
      <section class="charts-section">
        <div class="chart-container">
          <div class="chart-title">本周划线趋势</div>
          <div class="chart-placeholder">[ 图表占位区域 ]</div>
        </div>
        <div class="chart-container">
          <div class="chart-title">划线类型分布</div>
          <div class="chart-placeholder">[ 图表占位区域 ]</div>
        </div>
      </section>

      <!-- 最近任务列表 -->
      <section class="tasks-section">
        <div class="section-header">
          <h2>最近任务</h2>
          <button class="view-all-btn">查看全部</button>
        </div>
        <div class="tasks-table-container">
          <table class="tasks-table">
            <thead>
              <tr>
                <th>任务编号</th>
                <th>任务名称</th>
                <th>开始时间</th>
                <th>状态</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>CP-2024-001</td>
                <td>船体甲板划线</td>
                <td>2024-01-15 08:30</td>
                <td><span class="status completed">已完成</span></td>
                <td><button class="action-btn">详情</button></td>
              </tr>
              <tr>
                <td>CP-2024-002</td>
                <td>船舶上层建筑划线</td>
                <td>2024-01-15 14:20</td>
                <td><span class="status in-progress">进行中</span></td>
                <td><button class="action-btn">详情</button></td>
              </tr>
              <tr>
                <td>CP-2024-003</td>
                <td>船舶动力系统划线</td>
                <td>2024-01-16 09:00</td>
                <td><span class="status pending">待开始</span></td>
                <td><button class="action-btn">详情</button></td>
              </tr>
            </tbody>
          </table>
        </div>
      </section>
    </main>
  </div>
</template>

<script setup lang="ts">
</script>

<style scoped>
.dashboard-container {
  display: flex;
  height: 100vh;
  background-color: #f5f7fa;
}

/* 主内容区域样式 */
.main-content {
  width: 100%;
  min-height: 100vh;
  padding: 20px;
  overflow-y: auto;
}

/* 页面标题 */
.page-title {
  font-size: 24px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e5e7eb;
}

/* 数据概览卡片样式 */
.overview-section {
  padding: 20px;
}

.overview-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.card {
  background-color: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 15px;
}

.card-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #f0f9ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.card-content {
  flex: 1;
}

.card-value {
  font-size: 28px;
  font-weight: bold;
  color: #1f2937;
  margin-bottom: 4px;
}

.card-label {
  font-size: 14px;
  color: #6b7280;
}

/* 图表区域样式 */
.charts-section {
  padding: 0 20px 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.chart-container {
  background-color: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chart-title {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 15px;
}

.chart-placeholder {
  height: 200px;
  background-color: #f9fafb;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 14px;
}

/* 任务列表样式 */
.tasks-section {
  padding: 0 20px 20px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.section-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
}

.view-all-btn {
  padding: 6px 12px;
  background-color: transparent;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  color: #4b5563;
  transition: all 0.2s;
}

.view-all-btn:hover {
  background-color: #f9fafb;
}

.tasks-table-container {
  background-color: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tasks-table {
  width: 100%;
  border-collapse: collapse;
}

.tasks-table th,
.tasks-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.tasks-table th {
  font-weight: 600;
  color: #4b5563;
  font-size: 14px;
}

.tasks-table td {
  color: #6b7280;
  font-size: 14px;
}

.status {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.status.completed {
  background-color: #dcfce7;
  color: #166534;
}

.status.in-progress {
  background-color: #dbeafe;
  color: #1d4ed8;
}

.status.pending {
  background-color: #fef3c7;
  color: #92400e;
}

.action-btn {
  padding: 6px 12px;
  background-color: #3b82f6;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  color: white;
  transition: background-color 0.2s;
}

.action-btn:hover {
  background-color: #2563eb;
}
</style>